#include "main.h"
#include "costomizeswitch.h"
#include "24cxx.h"
#include "keyboard.h"

extern uint8_t selectedgroup;  //修改第x组，共三组，

void GroupChange(void);
//uint8_t IsDIPChange(void);

//uint8_t IsDIPChange(void)
//{
//	if(HAL_GPIO_ReadPin(DIP1_GPIO_Port, DIP1_Pin)
//			|| HAL_GPIO_ReadPin(DIP2_GPIO_Port, DIP2_Pin)
//			|| HAL_GPIO_ReadPin(DIP3_GPIO_Port, DIP3_Pin))
//		return 1;
//	else return 0;
//}
void GroupChange(void)
{
	if(HAL_GPIO_ReadPin(SWITCH1_GPIO_Port, SWITCH1_Pin) && HAL_GPIO_ReadPin(SWITCH2_GPIO_Port, SWITCH2_Pin))
	{
		selectedgroup=0;
	}
	else if(HAL_GPIO_ReadPin(SWITCH1_GPIO_Port, SWITCH1_Pin) && ! HAL_GPIO_ReadPin(SWITCH2_GPIO_Port, SWITCH2_Pin))
	{
		selectedgroup=1;
	}
	else if( ! HAL_GPIO_ReadPin(SWITCH1_GPIO_Port, SWITCH1_Pin) && HAL_GPIO_ReadPin(SWITCH2_GPIO_Port, SWITCH2_Pin))
	{
		selectedgroup=2;
	}
	else if( ! HAL_GPIO_ReadPin(SWITCH1_GPIO_Port, SWITCH1_Pin) && ! HAL_GPIO_ReadPin(SWITCH2_GPIO_Port, SWITCH2_Pin))
	{
		selectedgroup=3;
	}
}


//
//uint8_t WriteCostomizeKeyValue(uint8_t group)
//{
////
////	AT24CXX_Write(0x00, "EEPROM is ready", sizeof("EEPROM is ready"));
//
//}
